﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="user_index.aspx.cs" Inherits="user_user_index" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>用户管理</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="../css/ss01.css">
	<link rel="stylesheet" type="text/css" href="user.css">
    <script language="JScript" src="../js/Function.js"></script>
    <script language="JScript" src="../js/myCheck.js"></script>
    <script type="text/javascript" src="../jquery/126/jquery-1.2.6.js"></script>
    <script type="text/javascript" language="javascript">
		function chk() 
		{
			if(CheckText(form1.txtuserid,"登录名",20)==false) return false;
			if(CheckText(form1.txtusername,"姓名",20)==false) return false;
			if(document.getElementById('grpcode').value=="")
			{
			    alert('请选择分组！');
			    return false;
			}

			return true;
		}
		
		function opensetup(url)
		{
			//features = "dialogWidth:580px;dialogHeight:350px;dialogLeft:0px;dialogTop:0px;scroll=yes;help=no;status=no;resizable=yes;";
			features = "dialogWidth:580px;dialogHeight:350px;scroll=yes;help=no;status=no;resizable=yes;";
			window.showModalDialog(url+'?_='+(new Date()).getTime(),'_blank',features);
		}

		function OpenGrant(url) {
			//features = "dialogWidth:520px;dialogHeight:400px;dialogLeft:0px;dialogTop:0px;scroll:no;help:no;status:no;resizable:yes;";
			features = "dialogWidth:520px;dialogHeight:400px;scroll:no;help:no;status:no;resizable:yes;";
			window.showModalDialog(url+'&_='+(new Date()).getTime(),'_blank',features);
		}
		
		function initpwd(userid)
		{
		    if(confirm('是否要初始登录密码？'))
		    {
		        var newpwd=window.prompt('请为('+userid+')输入初始密码：','1234');
	            if(newpwd!=null)	            {	                var urlstring='user_index_chgpwd.aspx?userid='+userid+'&newpwd='+newpwd;        	        	                $.ajax({	                    url:urlstring,	                    type:'get',	                    dataType:'html',	                    error:function()	                    {	                        alert('操作失败！');	                    },	                    success: function(msg)	                    {	                        alert('操作成功！');	                    }	                });	            }		    }
		}
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
		<table cellSpacing="0" cellPadding="0" border="0" align="center">
		    <tr>
		        <td style="background-color:White;padding-right: 10px; padding-left: 10px; padding-bottom: 10px; padding-top: 10px;">
		            <table cellSpacing="0" cellPadding="0" width="800" align="center" border="0" style="background-color:White;">
		                <tr>
		                    <td style="BORDER-RIGHT: #90b0de 1px solid; BORDER-TOP: #90b0de 1px solid; BORDER-LEFT: #90b0de 1px solid; BORDER-BOTTOM: #90b0de 1px solid">
		                        <table width="100%" cellSpacing="0" cellPadding="0" align="center" border="0">
		                            <tr height="30">
		                                <td style="border-bottom: #90b0de 1px solid; background-color: #ecf5ff; font-weight: bold; color: #004499; border-top-width: 1px; border-left-width: 1px; border-left-color: #90b0de; border-top-color: #90b0de; border-right-width: 1px; border-right-color: #90b0de;">&nbsp;&nbsp;&nbsp;用户管理</td>
		                                <td align="right" style="border-bottom: #90b0de 1px solid; background-color: #ecf5ff; color: #004499; border-top-width: 1px; border-left-width: 1px; border-left-color: #90b0de; border-top-color: #90b0de; border-right-width: 1px; border-right-color: #90b0de;" ><a href="../user/user_logout.aspx">退出</a>&nbsp;&nbsp;&nbsp;</td>
		                            </tr>
		                        </table>
                                <div id="mnginput" style="margin-top:10px;margin-bottom:10px;margin-left:10px;">
                                    <table>
                                        <tr>
                                            <td>登录名<font color="red">(<asp:literal id="msg" runat="server" Text="*"></asp:literal>)</font></td>
                                            <td>姓名<asp:checkbox id="isshow" runat="server" Text="有效" Checked="True"></asp:checkbox></td>
                                            <td>所属分组</td>
                                            <td>级别</td>
                                        </tr>
                                        <tr>
                                            <td><asp:TextBox ID="txtuserid" runat="server" Width="100px"></asp:TextBox></td>
                                            <td><asp:TextBox ID="txtusername" runat="server" Width="130px"></asp:TextBox></td>
                                            <td>
                                                <asp:DropDownList ID="grpcode" runat="server">
                                                </asp:DropDownList>
                                            </td>
                                            <td>
                                                <asp:DropDownList ID="lvl" runat="server" Width="56px">
                                                    <asp:ListItem Selected="True" Value="1">1级</asp:ListItem>
                                                    <asp:ListItem Value="2">2级</asp:ListItem>
                                                    <asp:ListItem Value="3">3级</asp:ListItem>
                                                    <asp:ListItem Value="4">4级</asp:ListItem>
                                                </asp:DropDownList>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <div id="Div1" style="margin-top:10px;margin-bottom:0px;margin-left:10px;">
		                            <table cellSpacing="0" cellPadding="0" width="100%" border="0">
			                            <tr>
				                            <td height="24">
                                                <asp:button id="btnInsert" runat="server" Text="插入系统" OnClick="btnInsert_Click"></asp:button>
					                            <asp:button id="btnUpdate" runat="server" Text="保存修改" Enabled="False" OnClick="btnUpdate_Click"></asp:button>
					                            <asp:button id="btnCancel" runat="server" Text="取消修改" Enabled="False" OnClick="btnCancel_Click"></asp:button>
					                            &nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="用户分组" onclick="opensetup('user_group.aspx')" />
					                            <input type="button" value="权限组" onclick="opensetup('user_grantgroup.aspx')" />
					                            <input type="button" value="系统功能" onclick="opensetup('user_func.aspx')" />
				                            </td>
			                            </tr>
		                            </table>
                                </div>
                                <div style="border-top: #90b0de 1px solid;"></div>
                                <div id="mnglist" style="margin-top:10px;margin-bottom:10px;margin-left:10px;margin-right:10px;">
                                    <asp:DataList ID="dlTable" runat="server" Width="100%" OnItemCommand="dlTable_ItemCommand">
				                        <HeaderTemplate>
					                        <table width="100%" cellpadding="2" cellspacing="2">
						                        <tr>
								                    <td align="center" width="50" style="font-weight:bold;">单授权</td>
								                    <td align="center" width="50" style="font-weight:bold;">组授权</td>
							                        <td width="100" style="font-weight:bold;">登录名</td>
							                        <td style="font-weight:bold;">姓名</td>
							                        <td align="left" width="80" style="font-weight:bold;">所属分组</td>
							                        <td align="center" width="50" style="font-weight:bold;">级别</td>
							                        <td align="center" width="50" style="font-weight:bold;">状态</td>
							                        <td align="center" width="50" style="font-weight:bold;">密码</td>
							                        <td width='50'>&nbsp;</td>
						                        </tr>
			                                </table>
				                        </HeaderTemplate>
				                        <ItemTemplate>
					                        <table width="100%" cellpadding="2" cellspacing="2">
					                            <tr>
								                    <td align="center" width='50'><a href="javascript:;" onclick="OpenGrant('grant_single.aspx?userid=<%# DataBinder.Eval(Container.DataItem, "userid") %>')"><img border="0" src="../images/grant1.gif" alt="单授权"></a></td>
								                    <td align="center" width='50'><a href="javascript:;" onclick="OpenGrant('grant_group.aspx?userid=<%# DataBinder.Eval(Container.DataItem, "userid") %>')"><img border="0" src="../images/grant2.gif" alt="组授权"></a></td>
						                            <td width='100'><asp:linkbutton id="lbModify" runat="server" CommandName="Modify" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "userid") %>'><%#  DataBinder.Eval(Container.DataItem, "userid")%></asp:linkbutton></td>
						                            <td ><%#  DataBinder.Eval(Container.DataItem, "username") %></TD>
						                            <td align="left" width='80'><%#  DataBinder.Eval(Container.DataItem, "grpname") %></TD>
						                            <td align="center" width='50'><%#  DataBinder.Eval(Container.DataItem, "lvl") %></TD>
						                            <td align="center" width='50'><%#  DataBinder.Eval(Container.DataItem, "status") %></TD>
						                            <td align="center" width='50'><span onClick="initpwd('<%# DataBinder.Eval(Container.DataItem, "userid") %>')" style="cursor:hand;">重设</span></TD>
						                            <td align="center" width='50'><asp:linkbutton id="lbDelete" runat="server" CommandName="Delete" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "userid") %>'><img border="0" src="../images/delete.gif" alt="删除" onClick="javascript:{return confirm('删除操作不可恢复，确认吗？');}"></asp:linkbutton></td>
					                            </tr>
			                                </table>
				                        </ItemTemplate>
                                        <FooterTemplate>
			                            </FooterTemplate>
                                        <AlternatingItemStyle BackColor="#ECF5FF" />
                                        <SelectedItemStyle BackColor="#cee5fd" />
                                     </asp:DataList>
                                </div>
		                    </td>
		                </tr>
		            </table>
		            <div style="margin-left:6px;margin-top:6px;">
		            注意：权限组代码和系统功能代码不能相同！
		            </div>
		        </td>
		    </tr>
		</table>
    </div>
    </form>
</body>
</html>
